package motionsApp.client.randomization;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasWidgets;

public class RandomMotionPainter {
	final private Grid table;
	static boolean canTranslate;	
	
	public RandomMotionPainter(HasWidgets panel, final MotionRequestedCallback callback) {
		table = new Grid(1,2);
		panel.add(table);
		setMotion("Waiting for motion");
		Button newMotionButton = new Button("Again");
		table.setWidget(0, 1, newMotionButton);
		
		newMotionButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				setMotion("Waiting for motion");
				callback.newMotionRequested();
			}
		});
	}

	public void setMotion(String motion) {
		table.setText(0, 0, motion);		
	}
}
